Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added -self, -altservice and -u2u to getST for S4U2self abuse, S4U2self+u2u, and service substitution #1202

Closed
wants to merge 197 commits into from

Conversation

ShutdownRepo
Copy link
Contributor

My previous PR #1183 allowed getST to accept a custom ticket for S4U2Proxy and basically run S4U2Proxy without S4U2Self..
This edit allows to run S4U2Self only, with the -self flag, without having S4U2Proxy being engaged right after. This allows researchers to conduct S4U2Self separately but also allows for privilege escalation: https://exploit.ph/revisiting-delegate-2-thyself.html, https://cyberstoph.org/posts/2021/06/abusing-kerberos-s4u2self-for-local-privilege-escalation/

When running getST with the -self flag, the -spn becomes optional. In this case, the target principal is set to the user running getST. But when -spn is set, the S4U2Self request is attempted for that SPN, sometimes allowing lateral movement between services of a same account.

On a side note, what was previously possible in one step can now be run in two commands.

Screenshot from 2021-11-01 16-59-06

Screenshot from 2021-11-01 16-59-47

Nothing new here, it's already possible with Rubeus, but now Impacket's getST can do it.

Oh, also I changed the header from python to python3

@ShutdownRepo
Copy link
Contributor Author

This PR can now be used along other tools for sAMAccountName spoofing attacks 👍

ShutdownRepo and others added 6 commits September 14, 2022 18:09
# Conflicts:
#	examples/Get-GPPPassword.py
# Conflicts:
#	impacket/examples/ntlmrelayx/attacks/ldapattack.py
# Conflicts:
#	examples/ticketer.py
#	impacket/krb5/pac.py
# Conflicts:
#	impacket/smbserver.py
[getST.py] adding -u2u support in combination to -self for SPN-less RBCD
@ShutdownRepo
Copy link
Contributor Author

Adding -u2u capabilities (when used along -self), for SPN-less RBCD.

In 2022, Jame Forshaw demonstrated that the SPN requirement wasn't completely mandatory and RBCD could be operated without: Exploiting RBCD using a normal user. While this technique is a bit trickier and should absolutely be avoided on regular user accounts (the technique renders them unusable for normal people), it allows to abuse RBCD even if the MachineAccountQuota is set to 0. In this case, the first (edit the "rbcd" attribute) and last ("Pass-the-ticket") steps are the same. (thehacker.recipes)

@ShutdownRepo ShutdownRepo changed the title Added -self and -altservice to getST for S4U2self abuse and service substitution Added -self, -altservice and -u2u to getST for S4U2self abuse, S4U2self+u2u, and service substitution Sep 25, 2022
@anadrianmanrique
Copy link
Contributor

@ShutdownRepo Hi! do you think this could be revamped in the context of the current version?

@ShutdownRepo
Copy link
Contributor Author

ShutdownRepo commented Dec 11, 2023

I think I messed up somewhere, as this PR changes 26 files, and this wasn't intended.
From the comment log here, this PR should only introduce

  • the -self, -altservice, -u2u args for getST.py
  • ticketer.py for service substitution outside of getST.py
  • the renameMachine.py script for sAMAccountName spoofing

Everything else should be ignored, I will fix this PR accordingly

@ShutdownRepo
Copy link
Contributor Author

I think I fixed the PR but it seems there are now conflicts on two files that are not changed, why...
Anything you can do on your end to fix that?
Do you think there are other things to adjust in getST/tgssub/renameMachine itself ?

@anadrianmanrique
Copy link
Contributor

yeah, those conflicts related to this branch might be because of those files (ticketer.py, pac.py) got super outdated.
Anyway, I didn't spot those new examples :D. I think it would be better to split this PR into 2, and have getST.py changes and new examples in different PRs. What do you think?

@ShutdownRepo
Copy link
Contributor Author

yeah, those conflicts related to this branch might be because of those files (ticketer.py, pac.py) got super outdated. Anyway, I didn't spot those new examples :D. I think it would be better to split this PR into 2, and have getST.py changes and new examples in different PRs. What do you think?

I have no preference on this matter, feel free to split the PR if you prefer it that way 😉

@anadrianmanrique
Copy link
Contributor

anadrianmanrique commented Dec 12, 2023

ok tgssub is in its own PR #1256
same for renameMachine.py #1224
so it makes no sense to have them in the context of this PR. Lets remove them from here, follow them up in their own PR's ( as it should be) and continue with this one for further testing and integration. Thanks

@ShutdownRepo
Copy link
Contributor Author

ok tgssub is in its own PR #1256 same for renameMachine.py #1224 so it makes no sense to have them in the context of this PR. Lets remove them from here, follow them up in their own PR's ( as it should be) and continue with this one for further testing and integration. Thanks

Ah! Forgot about them, well done

@ShutdownRepo
Copy link
Contributor Author

@anadrianmanrique done, but the ticketer.py and pac.py still seem to be modified for some reason.. Don't know how to fix that

@anadrianmanrique
Copy link
Contributor

@ShutdownRepo ok, I've been testing the changes, so far everything looks ok. I would need you to resolve the conflicts in ticketer.py in your branch, in order to be able to merge this PR. Because of #1411, ticketer.py should be rebased to the latest version. Also ticketer.py and pac.py should be removed from the PR. Thanks

@anadrianmanrique
Copy link
Contributor

either that, or create a new PR with getST.py changes ( we will link it to this one later ). Whichever works best for you

@anadrianmanrique anadrianmanrique added the waiting for response Further information is needed from people who opened the issue or pull request label Jan 2, 2024
@anadrianmanrique
Copy link
Contributor

now merged in #1691. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium Medium priority item waiting for response Further information is needed from people who opened the issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.